var map = null;
var loc = new VELatLong(57.6964998814978, 11.9956102298414);
function GetMap() {
    map = new VEMap('map');
    map.LoadMap(loc, 15);
    map.AddShape(new VEShape(VEShapeType.Pushpin, loc));
}

var winW = 630;
function detectWidth() {
    if (document.body && document.body.offsetWidth) {
        winW = document.body.offsetWidth;
    }
    if (document.compatMode == 'CSS1Compat' &&
        document.documentElement &&
            document.documentElement.offsetWidth) {
        winW = document.documentElement.offsetWidth;
    }
    if (window.innerWidth && window.innerHeight) {
        winW = window.innerWidth;
    }
}

function openPopup() {
    detectWidth();
    if (winW < 1000) {
        return true;
    }
    $("#dialog").dialog("open");
    GetMap();
    return false;
}

$(document).ready(function () {
    $("#dialog").dialog({
        autoOpen: false,
        modal: true,
        height: 600,
        width: 800,
        resizable: false
    });
    $("#opener").click(function () {
        return openPopup();
    });
}); 